package com.example.testproj.aidl;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @des:
 * @author: 芮勤
 * @date: 19-5-28 20:31
 * @see {@link }
 */
public class Book implements Parcelable {
    private String bookName;
    private int id;
    private String auth;

    public Book(String bookName, int id, String auth) {
        this.bookName = bookName;
        this.id = id;
        this.auth = auth;
    }


    protected Book(Parcel in) {
        bookName = in.readString();
        id = in.readInt();
        auth = in.readString();
    }

    public static final Creator<Book> CREATOR = new Creator<Book>() {
        @Override
        public Book createFromParcel(Parcel in) {
            return new Book(in);
        }

        @Override
        public Book[] newArray(int size) {
            return new Book[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(auth);

        parcel.writeInt(id);
        parcel.writeString(bookName);
    }

    @Override
    public String toString() {
        return "Book{" +
                "bookName='" + bookName + '\'' +
                ", id=" + id +
                ", auth='" + auth + '\'' +
                '}';
    }
}
